import React from 'react';

export default class Image extends React.Component{
    
    render(){
        return <div className="image-view" style={{width: '400px'}}>
            <img width="100%" onClick={this.click} src={this.props.src} alt="" />    
        </div>;
    }

    click = () => {
        //调用父级组件传递过来的回调函数
        this.props.changeSrc();
    }
}